package com.tdkj.action.backstage.shop;

import java.util.List;

import javax.annotation.Resource;

import org.hibernate.Query;

import com.tdkj.action.BaseAction;
import com.tdkj.model.shop.BeanShop;
import com.tdkj.service.shop.IBeanShopRecommendationUseInfoService;
import com.tdkj.service.shop.IBeanShopService;


public class ShopManageAction extends BaseAction {
    
	private IBeanShopService shopService;
	
	private IBeanShopRecommendationUseInfoService shopRecommendationUseInfoService ;
	
	private Long id;
	
	private Long typeId;
	
	private List<BeanShop> shops ;
	
	
	public String execute() {
		String hql = "from " + BeanShop.class.getName() + " as bean order by createDate desc";
		Query query = this.createQuery(hql);
		this.queryByPage(query, "shopManageAction.action", 10);
		return "success";
	}
	
	public String recommendation(){
		shopRecommendationUseInfoService.create(id, typeId);
		return execute();
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public List<BeanShop> getShops() {
		return shops;
	}

	public void setShops(List<BeanShop> shops) {
		this.shops = shops;
	}

	@Resource
	public void setShopService(IBeanShopService shopService) {
		this.shopService = shopService;
	}

	@Resource
	public void setShopRecommendationUseInfoService(
			IBeanShopRecommendationUseInfoService shopRecommendationUseInfoService) {
		this.shopRecommendationUseInfoService = shopRecommendationUseInfoService;
	}

	public Long getTypeId() {
		return typeId;
	}

	public void setTypeId(Long typeId) {
		this.typeId = typeId;
	}

}
